<#include "/common/_layout.html">
<#assign pageJavascript>
<script type="text/javascript">
var connect = function(){
	$.post("/admin/device/test/connect",{cid:$("#clientid").val()},function(data){layer.msg(data.msg);});
};
var disconnect = function(){
	$.post("/admin/device/test/disconnect",{cid:$("#clientid").val()},function(data){layer.msg(data.msg);});
};
var publish = function(){
	$.post("/admin/device/test/publish",{para:$("#dmsg").val(),cid:$("#clientid").val()},function(data){layer.msg(data.msg);});
};
</script>
</#assign>
<@layout pageTitle="设备测试" pageJavascript=pageJavascript pageCss=pageCss>	
<h3 class="page-header">设备测试</h3>	
<form id = "form1" class="form-horizontal">
  <div class="form-group">
    <label for="id" class="col-sm-2 control-label">clientID</label>
    <div class="col-xs-5 col-sm-3">
      <input type="text" id="clientid" value="3db0c3b437056ade/ewewewee323232e" placeholder="请输入clientid" class="form-control">
    </div>
    <div class="col-xs-5 col-sm-2">    
      <button type="button" onclick="connect();" class="btn btn-success">连接订阅</button>
    </div>
  </div>
  <div class="form-group">
    <label for="pid" class="col-sm-2 control-label">发送消息</label>
    <div class="col-xs-10 col-sm-5">
    	<textarea id="dmsg" rows="5" class="form-control"></textarea>
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="button" onclick="publish();" class="btn btn-info">发布</button>
      <button type="button" onclick="disconnect();" class="btn btn-danger">断开</button>
    </div>
  </div>
</form>
</@layout>